package com.hehe;
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.InetAddress;
import java.util.Properties;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;







@SpringBootApplication
public class RootApplication {
	public static void main(String[] args) throws IOException {
		SpringApplication.run(RootApplication.class, args);

		String IPv4_address = InetAddress.getLocalHost().getHostAddress();
		System.out.println(IPv4_address);  // >>>  192.168.1.102

//      注意: 在打包的时候可能会导致报错, 找不到 src/main/resources/application.properties 路径
		InputStream in = new BufferedInputStream(new FileInputStream("src/main/resources/application.properties"));
		Properties p = new Properties();
		p.load(in);
		String server_port = p.getProperty("server.port");

		String WEB_site = "访问地址:  http://" + IPv4_address + ":" + server_port;
		String Local_WEB_site = "访问地址:  http://127.0.0.1" + ":" + server_port;
		System.out.println(WEB_site);
		System.out.println(Local_WEB_site);
		System.out.println("记得打开 phpstudy 内置的MySQL 服务器, 不然web应用没办法正常访问...");
	}
}




